#pragma once
#include <QWidget>
#include <QPainter>
#include <QFrame>
#include <QColor>
#include <QPen>
#include <QBrush>
#include <correlationmatrix.h>
#include <functionalnetwork.h>
#include <colormap.h>
#include <QImage>
#include <QMouseEvent>
#include <vtkLookupTable.h>
#include <QApplication>

class HeatMap :
	public QWidget
{
	Q_OBJECT

signals:
	void elementSelected(int, int);
	void elementClicked(int,int);

public:
	HeatMap(QWidget *parent = 0);
	~HeatMap(void);
	void setMatrix(CorrelationMatrix *matr);
	void recreate();
	void createLookupMatrix();
	QVector< QVector<QPoint*> > getLookupMatrix();
	CorrelationMatrix* getMatrix();
	void setNetwork(FunctionalNetwork *netw);
	QImage *im;
	
protected:
    void paintEvent(QPaintEvent *evt);
	void mouseMoveEvent(QMouseEvent *ev);
	void mousePressEvent(QMouseEvent *ev);

private:
	CorrelationMatrix *matrix;
	void updateSelection();
	//CPrecisionTimer *timer;
	QVector< QVector<QPoint*> > lookupMatrix;
	vtkLookupTable *colormap;
	FunctionalNetwork *network;

};
